package com.liveinstars.api.im.vo;

import com.onepiece.shipelves.common.enums.SystemExceptionEnum;
import com.onepiece.shipelves.common.exception.SystemException;
import lombok.Data;

import java.util.List;

/**
 * @author: zhouze
 * @date: 2020/3/20
 */
@Data
public class CandyBoxVO {

    /**
     * id
     */
    private Long id;

    /**
     * 消息id
     */
    private Long messageId;

    /**
     * 糖果数量
     */
    private Long candyNum;

    /**
     * 糖果类型 1-金币
     */
    private Integer candyType;

    /**
     * 状态 0 - 初始状态 1 - 已分完
     */
    private Integer status;

    /**
     * 糖果盒备注
     */
    private String remark = "恭喜发财，大吉大利";

    /**
     * 糖果盒类型 1 - 平均分糖果盒 2 - 拼手气糖果盒
     */
    private Integer boxType;

    /**
     * candy kids 数量
     */
    private Integer userNum;

    /**
     * 获得糖果用户
     */
    private List<CandyKidsVO> candyKidsList;

    /**
     * 目标id
     * toType = 0 => 目标用户id
     * totype = 1 => 目标群id
     */
    private Long toId;

    /**
     * 目标类型 0 - 用户红包 1 - 群红包
     */
    private Integer toType;

    public void mock() {
        this.setId(1L);
        this.setBoxType(1);
        this.setCandyNum(10L);
        this.setCandyType(1);
        this.setRemark("大吉大利");
        this.setUserNum(3);
        this.setStatus(1);
        this.setCandyKidsList(CandyKidsVO.mockList());
    }

    public void createCheck(){
        if (this.candyNum == null || candyNum.equals(0)
                || this.candyType == null
                || this.toType == null
                || this.toId == null || this.toId.equals(0)
                || this.userNum == null || this.userNum.equals(0)
                || this.boxType == null) {
            throw new SystemException(SystemExceptionEnum.MISSING_REQUEST_PARAM);
        }
    }
}
